var specList = [{
    name: '好看的衣服',
    option1: '蓝色',
    option2: 'S',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '蓝色',
    option2: 'M',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '蓝色',
    option2: 'L',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '红色',
    option2: 'M',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '红色',
    option2: 'L',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '黄色',
    option2: 'L',
    option3: '一件'
}, {
    name: '好看的衣服',
    option1: '绿色',
    option2: '不分大小',
    option3: ''
}, {
    name: '好看的衣服',
    option1: '黑色',
    option2: '不分大小',
    option3: '送袜子'
}]

//获取某一属性的全量
function getAllOption(datalist,option){
    var arr=[]
    for(let item of datalist){       
        if(!arr.includes(item[option])){
            arr.push(item[option]);
        }
    }
    return arr;
}
console.log(getAllOption(specList,"option1"));
console.log(getAllOption(specList,"option2"));
console.log(getAllOption(specList,"option3"));
//根据不同的属性，属性值，筛选数据
function getActiveByOption(datalist,option,value){
    var arr=[];
    for(let item of datalist){
        if(item[option]==value){
            arr.push(item);
        }
    }
    return arr
}
console.log(getActiveByOption(specList,"option2","L"));
console.log(getActiveByOption(specList,"option1","黄色"));


